package com.aaa.mysecurity.controller;

import com.aaa.mysecurity.util.Result;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ：ludi（206913808@qq.com）
 * @date ：Created in 2022/11/1 17:34
 * @description：
 * @modified By：
 * @version:
 */
@Controller
public class UserController {


    @GetMapping("/user/query")
    @ResponseBody
    @PreAuthorize(value = "hasAnyAuthority('/user/query')")
    public Result query(){
        return new Result(200,"查询成功","user::query");
    }

    @GetMapping("/user/delete")
    @PreAuthorize(value = "hasAnyAuthority('/user/delete')")
    @ResponseBody
    public Result delete(){
        return new Result(200,"查询成功","user::delete");
    }

    @GetMapping("/user/update")
    @PreAuthorize(value = "hasAnyAuthority('/user/update')")
    @ResponseBody
    public Result update(){
        return new Result(200,"查询成功","user::update");
    }

    @GetMapping("/user/insert")
    @PreAuthorize(value = "hasAnyAuthority('/user/insert')")
    @ResponseBody
    public Result insert(){
        return new Result(200,"查询成功","user::insert");
    }

    @GetMapping("/user/export")
    @PreAuthorize(value = "hasAnyAuthority('/user/export')")
    @ResponseBody
    public Result export(){
        return new Result(200,"查询成功","user::export");
    }
}